---
title: XML.encode()
api: XML.encode
---

## Description

<Summary/>

This method returns a [Data](/reference/api/Data) for the formatted text. When a string is needed, use [XML.stringify()](/reference/api/XML/stringify) instead, which could be a bit lower in performance.

## Syntax

``` js
XML.encode(node)
```

## Parameters

<Parameters/>

## See Also

* [XML](/reference/api/XML)
* [XML.decode()](/reference/api/XML/decode)
* [XML.parse()](/reference/api/XML/parse)
* [XML.stringify()](/reference/api/XML/stringify)
